<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#p1{
				position: relative;
				left:80px;
				top: 180px;
			}
		</style>
	</head>
	<body> 
		<div id="p1">
		<input type="radio" name="haha" onclick="lian(1)" checked/>1
		<input type="radio" name="haha" onclick="lian(2)"/>2
		<input type="radio" name="haha" onclick="lian(3)"/>3
		<input type="radio" name="haha" onclick="lian(4)"/>4
		<input type="radio" name="haha" onclick="lian(5)"/>5
		</div>
		<div><img src="img/1.gif" /></div>
		<script type="text/javascript">
			var ele=document.getElementsByTagName("div")[1];
			var img=ele.firstChild;
			function lian(num){
				if(num==1){

					img.setAttribute("src","img/1.gif");
//					ele.appendChild(img);
				}else if(num==2){
//					var img=document.createElement("img");
					img.setAttribute("src","img/2.gif");
//					ele.appendChild(img);
				}else if(num==3){
//					var img=document.createElement("img");
					img.setAttribute("src","img/3.jpg");
//					ele.appendChild(img);
				}else if(num==4){
//					var img=document.createElement("img");
					img.setAttribute("src","img/4.jpg");
//					ele.appendChild(img);
				}else if(num==5){
//					var img=document.createElement("img");
					img.setAttribute("src","img/5.gif");
//					ele.appendChild(img);
				}
			}
		</script>
	</body>
</html>
